@echo off

echo "Current cmake generator is %CMAKE_GENERATOR%"

REM 检查 CMAKE_GENERATOR 是否已定义且值正确
if defined CMAKE_GENERATOR (
    if not "%CMAKE_GENERATOR%"=="MinGW Makefiles" (
        echo "set cmake generator to MinGW Makefiles"
        setx CMAKE_GENERATOR "MinGW Makefiles"
        echo Please restart the script
        pause 
        exit 0
    )
) else (
    echo "set cmake generator to MinGW Makefiles"
    setx CMAKE_GENERATOR "MinGW Makefiles"
    echo Please restart the script
    pause
    exit 0
)

cd /d "%~dp0"
cmd /k "scripts\env.bat"